package com.qidianit.mes.production.controller;

import com.qidianit.common.pojo.MESResult;
import com.qidianit.mes.pojo.WorkmanshipMaterial;
import com.qidianit.mes.production.service.WorkmanshipMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author djl
 * @Time 2024/10/22 20:10
 */
@RestController
@RequestMapping("/workmanshipMaterial")
@CrossOrigin
public class WorkmanshipMaterialController {
    @Autowired
    private WorkmanshipMaterialService workmanshipMaterialService;
    @PostMapping ("/list")
    public MESResult list(@RequestBody WorkmanshipMaterial workmanshipMaterial,
                          @RequestParam(defaultValue = "1")int page,
                          @RequestParam(defaultValue = "10")int limit){
        return workmanshipMaterialService.list(workmanshipMaterial,page,limit);
    }
    @PostMapping ("/add")
    public MESResult add(@RequestBody WorkmanshipMaterial workmanshipMaterial){
        return workmanshipMaterialService.add(workmanshipMaterial);
    }
    @PostMapping("/edit")
    public MESResult edit(@RequestBody WorkmanshipMaterial workmanshipMaterial){
        return workmanshipMaterialService.edit(workmanshipMaterial);
    }
    @PostMapping("/listById")
    public MESResult listById(@RequestBody WorkmanshipMaterial workmanshipMaterial){
        return workmanshipMaterialService.listById(workmanshipMaterial);
    }
}
